<%-- 
    Document   : savenilai
    Created on : 16 Des 12, 14:52:11
    Author     : Apriani
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form method = post  action="inputNilai.jsp">
        
        <%
    String nilai = request.getParameter("nilai");
    String status = request.getParameter("status");
    String nama = request.getParameter("nama");
    model.DataBaseConnection conn = new model.DataBaseConnection();
    try {
        String insert = "update nilai set nilai = '" + nilai + "', status = '" + status + "'"
                + "where nama = '" + nama + "'";

        java.sql.Statement statement = conn.getConnection().createStatement();
        int OK = statement.executeUpdate(insert);
        if (OK != 0) {
%>

<strong>UPDATE SUKSES!!!</strong>
<br><br>
<%try {

        String query = "select * from nilai";
        java.sql.ResultSet result = statement.executeQuery(query);
%>

<%
        statement.close();
    } catch (Exception ex) {
        System.out.println("message: " + ex.getMessage());
    }
} else {%>
<strong>UPDATE GAGAL!!!</strong>
<%}
        statement.close();
    } catch (Exception ex) {
        out.println("message: " + ex.getMessage());
    }
%>
<a href="inputNilai.jsp">Input Again..!!!</a>
<input type="submit" value="input">
    </body>
</html>
